
<select id='id_des_country' class="option_search" name="countryid" onchange="getCityByCountry();" style="width:120px">
    <option value="">Quốc gia</option>
    <?php foreach ($country as $row) { ?>
        <option <?php
    if ($countryname == $row->QuocGia) {
        echo "selected";
    }
        ?> value="<?php echo $row->QuocGia; ?>"><?php echo $row->QuocGia; ?></option>
<?php } ?>
</select>             
<!--<span class="arrow"></span>-->
<?php if ($choice == '1') { ?>      
    <!-- List City -->
    <select  id='id_des_city' class="option_search" name="cityid" onchange="getRegionByCity();" style="width:120px;">
        <option value="" selected="selected">Thành phố</option>
        <?php foreach ($city as $row) { ?>
            <option value="<?php echo $row->Tinh_ThanhPho; ?>"><?php echo $row->Tinh_ThanhPho ?></option>
    <?php } ?>
    </select>

    <select  id='id_des_region' class="option_search" name="regionid" style="width:120px">
        <option value="" selected="selected">Khu vực</option>
    </select>
<?php } else {
    ?>
    <!-- List Region --> 
    <select  id='id_des_city' class="option_search" name="cityid" onchange="getRegionByCity();" style="width:120px;">
        <option value="" selected="selected">Thành phố</option>
        <?php foreach ($city as $row) { ?>
            <option <?php
        if ($cityname == $row->Tinh_ThanhPho) {
            echo "selected";
        }
        ?> value="<?php echo $row->Tinh_ThanhPho; ?>"><?php echo $row->Tinh_ThanhPho ?></option>
        <?php } ?>
    </select>

    <select  id='id_des_region' class="option_search" name="regionid" style="width:120px">
        <option value="" selected="selected">Khu vực</option>
    <?php foreach ($Region as $row) { ?>
            <option   value="<?php echo $row->Quan; ?>"><?php echo $row->Quan; ?></option>
    <?php } ?>
    </select>
<?php } ?>

	<div id="search_button_2" class="button1" style="display:inline; width:65px; padding-left:5px; padding-right:5px; padding-top:5px; padding-bottom:5px;">Tìm kiếm</div>

<script type="text/javascript">
	function displayButton(btn)
	{
		btn1 = document.getElementById("search_button_1");
		btn2 = document.getElementById("search_button_2");
		
		if(btn == 1)
		{
			btn1.style.display = "inline";
			btn2.style.display = "none";
		}
		else 
		{	
			btn2.style.display = "inline";
			btn1.style.display = "none";
			document.getElementById("searchname").value = "Nhập tên thành phố hoặc tên khách sạn...";												
		}
	}

    jQuery("#id_des_country").change(function()
	{
        var form_data = {
            choice: '1',
            quocgia:jQuery('#id_des_country').val()
        };
        jQuery.ajax({
            url: "<?php echo site_url('searchKhachSan/getCityByCountry'); ?>",
            type: "POST",
            data: form_data,
            dataType: 'html',
            success: function(mgs){jQuery('#destination_search').html(mgs);
                jQuery('#qg').val(jQuery('#id_des_country').val());}
        });
    });

    jQuery("#id_des_city").change(function()
	{
        var form_data = {
            choice: '2',
            quocgia:jQuery('#id_des_country').val(),
            thanhpho:jQuery('#id_des_city').val()
        };
        jQuery.ajax({
            url: "<?php echo site_url('searchKhachSan/getRegionByCity'); ?>",
            type:"POST",
            data: form_data,
            dataType: 'html',
            success: function(mgs){jQuery('#destination_search').html(mgs);jQuery('#tp').val(jQuery('#id_des_city').val());jQuery('#kv').val("");}
        });
    });
    
	jQuery("#id_des_region").change(function()
	{
        jQuery('#kv').val(jQuery('#id_des_region').val());
    });
	
	jQuery("#search_button_2").click(function()
	{
		if(jQuery('#id_des_country').val()=="")
		{
			alert("Xin vui lòng lựa chọn các tiêu chí có sẵn!");
			return;
		}
		if(jQuery('#id_des_city').val()=="")
		{
			alert("Xin vui lòng chọn thành phố!");
			return;
		}
		jQuery('#form_search_name').submit();
	});							

</script>